/*
 * Copyright (c) 2011. This file is public under GPLv3 license.
 * For more information about license please refer to http://www.gnu.org/licenses/gpl.html
 */

package com.freetools.watchdog.model;

/**
 * Description to be do.
 *
 * @author Michael Morozov
 */
public class CommaSeparateRecordFormatter implements IRecordFormatter
{

    public String format(IModelHolder model, IRecord record)
    {
        StringBuilder builder = new StringBuilder();
        builder.append(record.getId()).append(",");
        for (IColumn column : model.getColumns())
        {
            builder.append(record.getValue(column)).append(",");
        }
        builder
                .delete(builder.length() - 1, builder.length())
                .append("\n");
        return builder.toString();

    }
}
